
%post

# network

echo -e "DEVICE=eth0\nTYPE=Ethernet\nONBOOT=yes\nPROMISC=yes\nBOOTPROTO=none\nMASTER=bond0\nSLAVE=yes" > /etc/sysconfig/network-scripts/ifcfg-eth0
echo -e "DEVICE=eth1\nTYPE=Ethernet\nONBOOT=yes\nPROMISC=yes\nBOOTPROTO=none\nMASTER=bond0\nSLAVE=yes" > /etc/sysconfig/network-scripts/ifcfg-eth1
echo -e "DEVICE=eth2\nTYPE=Ethernet\nONBOOT=yes\nPROMISC=yes\nBOOTPROTO=none\nMASTER=bond0\nSLAVE=yes" > /etc/sysconfig/network-scripts/ifcfg-eth2
echo -e "DEVICE=eth3\nTYPE=Ethernet\nONBOOT=yes\nPROMISC=yes\nBOOTPROTO=none\nMASTER=bond0\nSLAVE=yes" > /etc/sysconfig/network-scripts/ifcfg-eth3
echo -e "DEVICE=eth5\nTYPE=Ethernet\nONBOOT=yes\nPROMISC=yes\nBOOTPROTO=none\nMASTER=bond0\nSLAVE=yes" > /etc/sysconfig/network-scripts/ifcfg-eth5
echo -e "DEVICE=bond0\nPROMISC=yes\nBOOTPROTO=static\nIPADDR=0.0.0.0\nONBOOT=yes\nTYPE=Ethernet" > /etc/sysconfig/network-scripts/ifcfg-bond0

echo -e 'alias bond0 bonding\noptions bond0 mode=0' >> /etc/modprobe.conf


echo "/usr/local/lib/" >> /etc/ld.so.conf
/sbin/ldconfig

# ssh
mkdir /root/.ssh
echo "ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQEA2R7UKD82azOirFCtVQac1PH3JMt3VmLZGUo2f0gtY0vvLHURIplWvRK8B7l2a7KPTW8okOB9LXqjzr38Df5EiJQ816g0QVpfsh4HVNLqQIlCepSsPsiBwwt9wyemviYIKQwQEN0dnuYWA+F1Nu+OIJMCRI2DYGlWHt8chaFfhkREHGiJIghPuZZS/i5gnAey+GLCHKRAUqyAbu6M3hsJMQy9QuJJzfLCD8J2u+Jo1ob56AT3xxdAEjVVH2iLuHc6jpIG9yVFXVgGAiOpmlFaQR/sV0DeLulip8U2O/SSvzaGBQpNXFH6g32H6RYAMkIR5mzl60Iak6PUc6msvAc26Q== rsa-key-20150717" > /root/.ssh/authorized_keys

echo "# ===================" >> /etc/ssh/sshd_config
echo "RSAAuthentication=yes" >> /etc/ssh/sshd_config
echo "PubkeyAuthentication=yes" >> /etc/ssh/sshd_config
echo "AuthorizedKeysFile=.ssh/authorized_keys" >> /etc/ssh/sshd_config
grep -v "^PasswordAuthentication" /etc/ssh/sshd_config > /etc/ssh/sshd_config2
mv /etc/ssh/sshd_config2 /etc/ssh/sshd_config
echo "PasswordAuthentication no" >> /etc/ssh/sshd_config

# Disable unused service
chkconfig ip6tables off
chkconfig postfix off
chkconfig mysqld on

reboot -f
%end
